package com.nanhang.test;
import com.nanhang.entity.Student;
import com.nanhang.service.IStudentService;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.List;
@SpringBootTest
public class testmp {

    @Autowired
    private IStudentService studentService;

    @Test
    public void test1() {
        List<Student> list = studentService.list();
        list.forEach(System.out::println);
    }

    @Test
    public void test2() {
        Student student = new Student();
        student.setSname("黄五");
        student.setSex("男");
        student.setAge(18);
        student.setAddr("南昌");
        student.setCid(1);
        studentService.save(student);

    }
    @Test
    public void test3() {
        Integer sid = 9;
        Student student = studentService.getById(sid);
        student.setSname("黄小五");
        student.setAddr("南昌红谷滩区");
        studentService.updateById(student);

    }

}
